package edu.whut.jdk8.instruct;
/*
Duration:天、时分秒毫秒纳秒
 */
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;

public class DurationDemo {
    public static void main(String[] args) {
        LocalDateTime today = LocalDateTime.now();
        System.out.println(today);

        LocalDateTime otherDate = LocalDateTime.of(2023,5,5,0,0,0);
        System.out.println(otherDate);

        Duration duration = Duration.between(otherDate,today);

        System.out.println(duration.toDays());
        System.out.println(duration.toHours());
        System.out.println(duration.toMinutes());
        System.out.println(duration.toMillis());
        System.out.println(duration.toNanos());
    }
}
